using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using WebCore;
using WebCore.Caching;

namespace WebController.Controllers.Admin
{
    public partial class AdminController : _baseAdminController
    {
        [AcceptVerbs(HttpVerbs.Get)]
        public ActionResult UserList()
        {
            return View(_usersRepository.GetAll().ToList());
        }


        // do not delete user, cause it dose not delete events
        [AcceptVerbs(HttpVerbs.Get)]
        public ActionResult UserDelete(int userID)
        {

            _usersRepository.Delete(userID);

            // remove cache
            WebCache.Remove(string.Format(Settings.Cache_User_ID_Key,userID));
            WebCache.RemoveByPattern(Settings.Cache_Event_Pattern_Key);
            return RedirectToAction("UserList");
          
        }
        

    }
}
